package com.prs.crm.domain.official;

import java.util.Date;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.BaseEntity;
/**
 * 
 * @author Yanghao
 *	2012-8-23 17:52:44 发送短消息
 */
@Entity
@Table(name="official_shortmessage")
public class ShortMessage extends BaseEntity{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private String title;  //标题
	@Lob
	private String content;  //内容
	private String receive; //接收人
	private String accepts;  //接收人id
	private String degree;  //重要程度
	private String isReceipt;  //收到后给我一个回执
	private String isComment;  //允许评论
	private String level;  //样式
	
	private Integer oabox;  //0表示草稿，1表示已发新闻，2表示已归档,3表示已收藏
	
	private String flow;  //流程
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade(CascadeType.REFRESH)
	private Attachment attach; //文件
	private Date creatTime;  //创建时间
	//收藏新闻
	@OneToMany(fetch=FetchType.LAZY,mappedBy="shortMessage")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Set<ShortMessageCollect> shortMessageCollects; 
//	//已收新闻
//	@OneToMany(fetch=FetchType.LAZY,mappedBy="shortMessage")
//	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
//	private Set<ShortMessageReceive> shortMessageReceives;
	
	private Integer top;//0位置顶 //1置顶 
	public Integer getTop() {
		return top;
	}
	public void setTop(Integer top) {
		this.top = top;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getReceive() {
		return receive;
	}
	public void setReceive(String receive) {
		this.receive = receive;
	}
	public String getDegree() {
		return degree;
	}
	public void setDegree(String degree) {
		this.degree = degree;
	}
	public String getIsReceipt() {
		return isReceipt;
	}
	public void setIsReceipt(String isReceipt) {
		this.isReceipt = isReceipt;
	}
	public String getIsComment() {
		return isComment;
	}
	public void setIsComment(String isComment) {
		this.isComment = isComment;
	}
	public String getLevel() {
		return level;
	}
	public void setLevel(String level) {
		this.level = level;
	}
	public Integer getOabox() {
		return oabox;
	}
	public void setOabox(Integer oabox) {
		this.oabox = oabox;
	}
	public String getFlow() {
		return flow;
	}
	public void setFlow(String flow) {
		this.flow = flow;
	}
	public Attachment getAttach() {
		return attach;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public Date getCreatTime() {
		return creatTime;
	}
	public void setCreatTime(Date creatTime) {
		this.creatTime = creatTime;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}

	public String getAccepts() {
		return accepts;
	}
	public void setAccepts(String accepts) {
		this.accepts = accepts;
	}
	public Set<ShortMessageCollect> getShortMessageCollects() {
		return shortMessageCollects;
	}
	public void setShortMessageCollects(
			Set<ShortMessageCollect> shortMessageCollects) {
		this.shortMessageCollects = shortMessageCollects;
	}
//	public Set<ShortMessageReceive> getShortMessageReceives() {
//		return shortMessageReceives;
//	}
//	public void setShortMessageReceives(
//			Set<ShortMessageReceive> shortMessageReceives) {
//		this.shortMessageReceives = shortMessageReceives;
//	}
}
